home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / develop™ Technical Journal / develop Issue 26 code / Truffles-Display Mgr.sit / Truffles - Display Mgr. / Sprocket / Sources / AEThreads.cp next >
MacBinary  |  1995-05-31  |  4.8 KB  |  [TEXT/MMCC]

open in: MacOS 8.1     |     Win98     |     DOS

browse contents    |     view JSON data     |     view as text


This file was processed as: MacBinary (archive/macBinary).

ConfidenceProgramDetectionMatch TypeSupport
10% dexvert MacBinary (archive/macBinary) fallback Supported
1% dexvert MS-DOS Code Page Info (other/dosCodePage) ext Unsupported
1% dexvert Text File (text/txt) fallback Supported
100% file MacBinary II, inited, Wed May 31 00:12:10 1995, modified Wed May 31 00:12:10 1995, creator 'MMCC', type ASCII, 4051 bytes "AEThreads.cp" , at 0x1053 603 bytes resource default (weak)
99% file data default
74% TrID Macintosh plain text (MacBinary) default
25% TrID MacBinary 2 default (weak)
100% siegfried fmt/1762 MacBinary (II) default
100% lsar MacBinary default


id metadata
keyvalue
macFileType[TEXT]
macFileCreator[MMCC]



hex view
+--------+-------------------------+-------------------------+--------+--------+
|00000000| 00 0c 41 45 54 68 72 65 | 61 64 73 2e 63 70 00 00 |..AEThre|ads.cp..|
|00000010| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000020| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000030| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000040| 00 54 45 58 54 4d 4d 43 | 43 01 00 00 00 00 00 00 |.TEXTMMC|C.......|
|00000050| 00 00 00 00 00 0f d3 00 | 00 02 5b ab f1 9d 1a ab |........|..[.....|
|00000060| f1 9d 1a 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00000070| 00 00 00 00 00 00 00 00 | 00 00 81 81 5b f6 00 00 |........|....[...|
|00000080| 2f 2a 0d 09 46 69 6c 65 | 3a 09 09 41 45 54 68 72 |/*..File|:..AEThr|
|00000090| 65 61 64 73 2e 63 0d 20 | 09 09 09 09 20 0d 09 43 |eads.c. |.... ..C|
|000000a0| 6f 6e 74 61 69 6e 73 3a | 09 52 6f 75 74 69 6e 65 |ontains:|.Routine|
|000000b0| 73 20 66 6f 72 20 69 6e | 73 74 61 6c 6c 69 6e 67 |s for in|stalling|
|000000c0| 20 74 68 72 65 61 64 65 | 64 20 41 70 70 6c 65 45 | threade|d AppleE|
|000000d0| 76 65 6e 74 20 68 61 6e | 64 6c 65 72 73 0d 0d 09 |vent han|dlers...|
|000000e0| 57 72 69 74 74 65 6e 20 | 62 79 3a 20 53 74 65 76 |Written |by: Stev|
|000000f0| 65 20 53 69 73 61 6b 0d | 0d 20 09 43 6f 70 79 72 |e Sisak.|. .Copyr|
|00000100| 69 67 68 74 3a 09 a9 20 | 31 39 39 33 2d 39 34 20 |ight:.. |1993-94 |
|00000110| 53 74 65 76 65 20 53 69 | 73 61 6b 0d 09 09 09 09 |Steve Si|sak.....|
|00000120| 4c 69 63 65 6e 73 65 20 | 69 73 20 67 72 61 6e 74 |License |is grant|
|00000130| 65 64 20 74 6f 20 75 73 | 65 2c 20 6d 6f 64 69 66 |ed to us|e, modif|
|00000140| 79 2c 20 6d 61 6b 65 20 | 64 65 72 69 76 61 74 69 |y, make |derivati|
|00000150| 76 65 20 77 6f 72 6b 73 | 2c 20 61 6e 64 20 0d 09 |ve works|, and ..|
|00000160| 09 09 09 64 75 70 6c 69 | 63 61 74 65 20 74 68 69 |...dupli|cate thi|
|00000170| 73 20 63 6f 64 65 20 61 | 74 20 77 69 6c 6c 2c 20 |s code a|t will, |
|00000180| 73 6f 20 6c 6f 6e 67 20 | 61 73 20 74 68 69 73 20 |so long |as this |
|00000190| 6e 6f 74 69 63 65 20 72 | 65 6d 61 69 6e 73 20 69 |notice r|emains i|
|000001a0| 6e 74 61 63 74 2e 0d 0d | 09 43 68 61 6e 67 65 20 |ntact...|.Change |
|000001b0| 48 69 73 74 6f 72 79 20 | 28 6d 6f 73 74 20 72 65 |History |(most re|
|000001c0| 63 65 6e 74 20 66 69 72 | 73 74 29 3a 0d 09 0d 09 |cent fir|st):....|
|000001d0| 09 20 3c 31 3e 09 20 31 | 2f 32 34 2f 39 35 09 44 |. <1>. 1|/24/95.D|
|000001e0| 52 46 09 09 46 69 72 73 | 74 20 63 68 65 63 6b 65 |RF..Firs|t checke|
|000001f0| 64 20 69 6e 2e 0d 2a 2f | 0d 0d 23 69 66 6e 64 65 |d in..*/|..#ifnde|
|00000200| 66 20 5f 5f 41 45 54 48 | 52 45 41 44 53 5f 5f 0d |f __AETH|READS__.|
|00000210| 23 69 6e 63 6c 75 64 65 | 20 22 41 45 54 68 72 65 |#include| "AEThre|
|00000220| 61 64 73 2e 68 22 0d 23 | 65 6e 64 69 66 0d 23 69 |ads.h".#|endif.#i|
|00000230| 66 6e 64 65 66 20 5f 5f | 45 52 52 4f 52 53 5f 5f |fndef __|ERRORS__|
|00000240| 0d 23 69 6e 63 6c 75 64 | 65 20 3c 45 72 72 6f 72 |.#includ|e <Error|
|00000250| 73 2e 68 3e 0d 23 65 6e | 64 69 66 0d 23 69 66 6e |s.h>.#en|dif.#ifn|
|00000260| 64 65 66 20 5f 5f 41 50 | 50 4c 45 45 56 45 4e 54 |def __AP|PLEEVENT|
|00000270| 53 5f 5f 0d 23 69 6e 63 | 6c 75 64 65 20 3c 41 70 |S__.#inc|lude <Ap|
|00000280| 70 6c 65 45 76 65 6e 74 | 73 2e 68 3e 0d 23 65 6e |pleEvent|s.h>.#en|
|00000290| 64 69 66 0d 0d 23 69 6e | 63 6c 75 64 65 20 22 54 |dif..#in|clude "T|
|000002a0| 68 72 65 61 64 43 6f 6e | 74 65 78 74 2e 68 22 0d |hreadCon|text.h".|
|000002b0| 23 69 6e 63 6c 75 64 65 | 20 22 45 78 63 65 70 74 |#include| "Except|
|000002c0| 69 6f 6e 73 2e 68 22 0d | 0d 0d 70 61 73 63 61 6c |ions.h".|..pascal|
|000002d0| 20 4f 53 45 72 72 20 53 | 70 61 77 6e 41 45 54 68 | OSErr S|pawnAETh|
|000002e0| 72 65 61 64 28 63 6f 6e | 73 74 20 41 70 70 6c 65 |read(con|st Apple|
|000002f0| 45 76 65 6e 74 20 2a 74 | 68 65 41 70 70 6c 65 45 |Event *t|heAppleE|
|00000300| 76 65 6e 74 2c 20 41 70 | 70 6c 65 45 76 65 6e 74 |vent, Ap|pleEvent|
|00000310| 20 2a 72 65 70 6c 79 2c | 20 6c 6f 6e 67 20 68 61 | *reply,| long ha|
|00000320| 6e 64 6c 65 72 52 65 66 | 63 6f 6e 29 3b 0d 0d 63 |ndlerRef|con);..c|
|00000330| 6c 61 73 73 20 41 45 54 | 68 72 65 61 64 43 6f 6e |lass AET|hreadCon|
|00000340| 74 65 78 74 20 3a 20 70 | 75 62 6c 69 63 20 54 54 |text : p|ublic TT|
|00000350| 68 72 65 61 64 43 6f 6e | 74 65 78 74 0d 7b 0d 70 |hreadCon|text.{.p|
|00000360| 72 6f 74 65 63 74 65 64 | 3a 0d 09 41 45 45 76 65 |rotected|:..AEEve|
|00000370| 6e 74 48 61 6e 64 6c 65 | 72 55 50 50 09 66 48 61 |ntHandle|rUPP.fHa|
|00000380| 6e 64 6c 65 72 3b 09 2f | 2f 20 54 68 65 20 72 65 |ndler;./|/ The re|
|00000390| 61 6c 20 68 61 6e 64 6c | 65 72 0d 09 63 6f 6e 73 |al handl|er..cons|
|000003a0| 74 20 41 70 70 6c 65 45 | 76 65 6e 74 2a 09 66 45 |t AppleE|vent*.fE|
|000003b0| 76 65 6e 74 3b 0d 09 41 | 70 70 6c 65 45 76 65 6e |vent;..A|ppleEven|
|000003c0| 74 2a 09 09 09 66 52 65 | 70 6c 79 3b 0d 09 6c 6f |t*...fRe|ply;..lo|
|000003d0| 6e 67 09 09 09 09 66 52 | 65 66 63 6f 6e 3b 0d 0d |ng....fR|efcon;..|
|000003e0| 70 75 62 6c 69 63 3a 0d | 09 41 45 54 68 72 65 61 |public:.|.AEThrea|
|000003f0| 64 43 6f 6e 74 65 78 74 | 28 41 45 45 76 65 6e 74 |dContext|(AEEvent|
|00000400| 48 61 6e 64 6c 65 72 55 | 50 50 20 68 61 6e 64 6c |HandlerU|PP handl|
|00000410| 65 72 2c 20 63 6f 6e 73 | 74 20 41 70 70 6c 65 45 |er, cons|t AppleE|
|00000420| 76 65 6e 74 2a 20 65 76 | 65 6e 74 2c 20 41 70 70 |vent* ev|ent, App|
|00000430| 6c 65 45 76 65 6e 74 2a | 20 72 65 70 6c 79 2c 20 |leEvent*| reply, |
|00000440| 6c 6f 6e 67 20 72 65 66 | 63 6f 6e 29 20 3a 20 66 |long ref|con) : f|
|00000450| 48 61 6e 64 6c 65 72 28 | 68 61 6e 64 6c 65 72 29 |Handler(|handler)|
|00000460| 2c 20 66 45 76 65 6e 74 | 28 65 76 65 6e 74 29 2c |, fEvent|(event),|
|00000470| 20 66 52 65 70 6c 79 28 | 72 65 70 6c 79 29 2c 20 | fReply(|reply), |
|00000480| 66 52 65 66 63 6f 6e 28 | 72 65 66 63 6f 6e 29 20 |fRefcon(|refcon) |
|00000490| 7b 7d 3b 0d 09 76 69 72 | 74 75 61 6c 09 7e 41 45 |{};..vir|tual.~AE|
|000004a0| 54 68 72 65 61 64 43 6f | 6e 74 65 78 74 28 29 20 |ThreadCo|ntext() |
|000004b0| 7b 7d 3b 0d 09 0d 09 73 | 74 61 74 69 63 20 70 61 |{};....s|tatic pa|
|000004c0| 73 63 61 6c 20 76 6f 69 | 64 2a 09 09 09 41 45 54 |scal voi|d*...AET|
|000004d0| 68 72 65 61 64 50 72 6f | 63 28 41 45 54 68 72 65 |hreadPro|c(AEThre|
|000004e0| 61 64 43 6f 6e 74 65 78 | 74 2a 20 63 6f 6e 74 65 |adContex|t* conte|
|000004f0| 78 74 29 3b 0d 0d 09 66 | 72 69 65 6e 64 20 70 61 |xt);...f|riend pa|
|00000500| 73 63 61 6c 20 4f 53 45 | 72 72 20 53 70 61 77 6e |scal OSE|rr Spawn|
|00000510| 41 45 54 68 72 65 61 64 | 28 63 6f 6e 73 74 20 41 |AEThread|(const A|
|00000520| 70 70 6c 65 45 76 65 6e | 74 20 2a 74 68 65 41 70 |ppleEven|t *theAp|
|00000530| 70 6c 65 45 76 65 6e 74 | 2c 20 41 70 70 6c 65 45 |pleEvent|, AppleE|
|00000540| 76 65 6e 74 20 2a 72 65 | 70 6c 79 2c 20 6c 6f 6e |vent *re|ply, lon|
|00000550| 67 20 68 61 6e 64 6c 65 | 72 52 65 66 63 6f 6e 29 |g handle|rRefcon)|
|00000560| 3b 0d 7d 3b 0d 0d 73 74 | 72 75 63 74 20 41 45 54 |;.};..st|ruct AET|
|00000570| 68 72 65 61 64 44 65 73 | 63 09 09 09 09 09 2f 2f |hreadDes|c.....//|
|00000580| 20 4b 65 70 74 20 69 6e | 20 74 68 65 20 4f 53 20 | Kept in| the OS |
|00000590| 72 65 66 63 6f 6e 0d 7b | 0d 09 41 45 45 76 65 6e |refcon.{|..AEEven|
|000005a0| 74 48 61 6e 64 6c 65 72 | 55 50 50 09 68 61 6e 64 |tHandler|UPP.hand|
|000005b0| 6c 65 72 3b 09 2f 2f 20 | 54 68 65 20 72 65 61 6c |ler;.// |The real|
|000005c0| 20 68 61 6e 64 6c 65 72 | 0d 09 6c 6f 6e 67 09 09 | handler|..long..|
|000005d0| 09 09 72 65 66 63 6f 6e | 3b 09 09 2f 2f 20 54 68 |..refcon|;..// Th|
|000005e0| 65 20 72 65 61 6c 20 72 | 65 66 63 6f 6e 0d 09 53 |e real r|efcon..S|
|000005f0| 69 7a 65 09 09 09 09 73 | 74 61 63 6b 53 69 7a 65 |ize....s|tackSize|
|00000600| 3b 09 2f 2f 20 53 74 61 | 63 6b 20 73 69 7a 65 20 |;.// Sta|ck size |
|00000610| 66 6f 72 20 68 61 6e 64 | 6c 69 6e 67 20 65 76 65 |for hand|ling eve|
|00000620| 6e 74 0d 09 54 68 72 65 | 61 64 4f 70 74 69 6f 6e |nt..Thre|adOption|
|00000630| 73 09 09 6f 70 74 69 6f | 6e 73 3b 09 2f 2f 20 54 |s..optio|ns;.// T|
|00000640| 68 72 65 61 64 20 6f 70 | 74 69 6f 6e 73 20 66 6f |hread op|tions fo|
|00000650| 72 20 65 76 65 6e 74 0d | 09 54 68 72 65 61 64 49 |r event.|.ThreadI|
|00000660| 44 09 09 09 68 6f 6c 64 | 65 72 3b 09 09 2f 2f 20 |D...hold|er;..// |
|00000670| 75 73 65 64 20 61 73 20 | 61 20 73 65 6d 61 70 68 |used as |a semaph|
|00000680| 6f 72 65 0d 7d 3b 0d 0d | 41 45 45 76 65 6e 74 48 |ore.};..|AEEventH|
|00000690| 61 6e 64 6c 65 72 55 50 | 50 20 67 53 70 61 77 6e |andlerUP|P gSpawn|
|000006a0| 41 45 54 68 72 65 61 64 | 55 50 50 20 3d 20 6e 69 |AEThread|UPP = ni|
|000006b0| 6c 3b 0d 0d 2f 2f 23 70 | 72 61 67 6d 61 20 73 65 |l;..//#p|ragma se|
|000006c0| 67 6d 65 6e 74 20 66 6f | 6f 62 61 72 0d 0d 70 61 |gment fo|obar..pa|
|000006d0| 73 63 61 6c 20 4f 53 45 | 72 72 20 41 45 49 6e 73 |scal OSE|rr AEIns|
|000006e0| 74 61 6c 6c 54 68 72 65 | 61 64 65 64 45 76 65 6e |tallThre|adedEven|
|000006f0| 74 48 61 6e 64 6c 65 72 | 28 0d 09 41 45 45 76 65 |tHandler|(..AEEve|
|00000700| 6e 74 43 6c 61 73 73 09 | 09 74 68 65 41 45 45 76 |ntClass.|.theAEEv|
|00000710| 65 6e 74 43 6c 61 73 73 | 2c 0d 09 41 45 45 76 65 |entClass|,..AEEve|
|00000720| 6e 74 49 44 09 09 09 74 | 68 65 41 45 45 76 65 6e |ntID...t|heAEEven|
|00000730| 74 49 44 2c 0d 09 41 45 | 45 76 65 6e 74 48 61 6e |tID,..AE|EventHan|
|00000740| 64 6c 65 72 55 50 50 09 | 70 72 6f 63 2c 0d 09 6c |dlerUPP.|proc,..l|
|00000750| 6f 6e 67 09 09 09 09 68 | 61 6e 64 6c 65 72 52 65 |ong....h|andlerRe|
|00000760| 66 63 6f 6e 2c 0d 09 54 | 68 72 65 61 64 4f 70 74 |fcon,..T|hreadOpt|
|00000770| 69 6f 6e 73 09 09 6f 70 | 74 69 6f 6e 73 2c 0d 09 |ions..op|tions,..|
|00000780| 53 69 7a 65 09 09 09 09 | 73 74 61 63 6b 73 69 7a |Size....|stacksiz|
|00000790| 65 29 0d 7b 0d 09 41 45 | 54 68 72 65 61 64 44 65 |e).{..AE|ThreadDe|
|000007a0| 73 63 2a 20 64 65 73 63 | 20 3d 20 28 41 45 54 68 |sc* desc| = (AETh|
|000007b0| 72 65 61 64 44 65 73 63 | 2a 29 20 4e 65 77 50 74 |readDesc|*) NewPt|
|000007c0| 72 28 73 69 7a 65 6f 66 | 28 41 45 54 68 72 65 61 |r(sizeof|(AEThrea|
|000007d0| 64 44 65 73 63 29 29 3b | 0d 09 4f 53 45 72 72 09 |dDesc));|..OSErr.|
|000007e0| 09 20 20 65 72 72 20 20 | 3d 20 4d 65 6d 45 72 72 |. err |= MemErr|
|000007f0| 6f 72 28 29 3b 0d 09 0d | 09 69 66 20 28 67 53 70 |or();...|.if (gSp|
|00000800| 61 77 6e 41 45 54 68 72 | 65 61 64 55 50 50 20 3d |awnAEThr|eadUPP =|
|00000810| 3d 20 6e 69 6c 29 0d 09 | 7b 0d 09 09 67 53 70 61 |= nil)..|{...gSpa|
|00000820| 77 6e 41 45 54 68 72 65 | 61 64 55 50 50 20 3d 20 |wnAEThre|adUPP = |
|00000830| 4e 65 77 41 45 45 76 65 | 6e 74 48 61 6e 64 6c 65 |NewAEEve|ntHandle|
|00000840| 72 50 72 6f 63 28 53 70 | 61 77 6e 41 45 54 68 72 |rProc(Sp|awnAEThr|
|00000850| 65 61 64 29 3b 0d 09 7d | 0d 09 0d 09 69 66 20 28 |ead);..}|....if (|
|00000860| 65 72 72 20 3d 3d 20 6e | 6f 45 72 72 29 0d 09 7b |err == n|oErr)..{|
|00000870| 0d 09 09 64 65 73 63 2d | 3e 68 61 6e 64 6c 65 72 |...desc-|>handler|
|00000880| 09 3d 20 70 72 6f 63 3b | 0d 09 09 64 65 73 63 2d |.= proc;|...desc-|
|00000890| 3e 72 65 66 63 6f 6e 09 | 3d 20 68 61 6e 64 6c 65 |>refcon.|= handle|
|000008a0| 72 52 65 66 63 6f 6e 3b | 0d 09 09 64 65 73 63 2d |rRefcon;|...desc-|
|000008b0| 3e 73 74 61 63 6b 53 69 | 7a 65 09 3d 20 73 74 61 |>stackSi|ze.= sta|
|000008c0| 63 6b 73 69 7a 65 3b 0d | 09 09 64 65 73 63 2d 3e |cksize;.|..desc->|
|000008d0| 6f 70 74 69 6f 6e 73 09 | 3d 20 6f 70 74 69 6f 6e |options.|= option|
|000008e0| 73 3b 0d 09 09 64 65 73 | 63 2d 3e 68 6f 6c 64 65 |s;...des|c->holde|
|000008f0| 72 09 3d 20 6b 4e 6f 54 | 68 72 65 61 64 49 44 3b |r.= kNoT|hreadID;|
|00000900| 0d 0d 09 09 65 72 72 20 | 3d 20 41 45 49 6e 73 74 |....err |= AEInst|
|00000910| 61 6c 6c 45 76 65 6e 74 | 48 61 6e 64 6c 65 72 28 |allEvent|Handler(|
|00000920| 74 68 65 41 45 45 76 65 | 6e 74 43 6c 61 73 73 2c |theAEEve|ntClass,|
|00000930| 20 74 68 65 41 45 45 76 | 65 6e 74 49 44 2c 20 67 | theAEEv|entID, g|
|00000940| 53 70 61 77 6e 41 45 54 | 68 72 65 61 64 55 50 50 |SpawnAET|hreadUPP|
|00000950| 2c 20 28 6c 6f 6e 67 29 | 20 64 65 73 63 2c 20 66 |, (long)| desc, f|
|00000960| 61 6c 73 65 29 3b 0d 09 | 7d 0d 09 0d 09 72 65 74 |alse);..|}....ret|
|00000970| 75 72 6e 20 65 72 72 3b | 0d 7d 0d 0d 0d 70 61 73 |urn err;|.}...pas|
|00000980| 63 61 6c 20 76 6f 69 64 | 2a 20 41 45 54 68 72 65 |cal void|* AEThre|
|00000990| 61 64 43 6f 6e 74 65 78 | 74 3a 3a 41 45 54 68 72 |adContex|t::AEThr|
|000009a0| 65 61 64 50 72 6f 63 28 | 41 45 54 68 72 65 61 64 |eadProc(|AEThread|
|000009b0| 43 6f 6e 74 65 78 74 2a | 20 63 6f 6e 74 65 78 74 |Context*| context|
|000009c0| 29 0d 7b 0d 09 4f 53 45 | 72 72 20 72 65 73 75 6c |).{..OSE|rr resul|
|000009d0| 74 20 3d 20 6e 6f 45 72 | 72 3b 0d 0d 09 54 72 79 |t = noEr|r;...Try|
|000009e0| 0d 09 7b 0d 09 09 72 65 | 73 75 6c 74 20 3d 20 43 |..{...re|sult = C|
|000009f0| 61 6c 6c 41 45 45 76 65 | 6e 74 48 61 6e 64 6c 65 |allAEEve|ntHandle|
|00000a00| 72 50 72 6f 63 28 63 6f | 6e 74 65 78 74 2d 3e 66 |rProc(co|ntext->f|
|00000a10| 48 61 6e 64 6c 65 72 2c | 20 63 6f 6e 74 65 78 74 |Handler,| context|
|00000a20| 2d 3e 66 45 76 65 6e 74 | 2c 20 63 6f 6e 74 65 78 |->fEvent|, contex|
|00000a30| 74 2d 3e 66 52 65 70 6c | 79 2c 20 63 6f 6e 74 65 |t->fRepl|y, conte|
|00000a40| 78 74 2d 3e 66 52 65 66 | 63 6f 6e 29 3b 0d 0d 09 |xt->fRef|con);...|
|00000a50| 09 2f 2f 20 53 69 6e 63 | 65 20 74 68 65 20 65 76 |.// Sinc|e the ev|
|00000a60| 65 6e 74 20 77 61 73 20 | 73 75 73 70 65 6e 64 65 |ent was |suspende|
|00000a70| 64 2c 20 77 65 20 6e 65 | 65 64 20 74 6f 20 73 74 |d, we ne|ed to st|
|00000a80| 75 66 66 20 74 68 65 20 | 65 72 72 6f 72 20 63 6f |uff the |error co|
|00000a90| 64 65 20 6f 75 72 73 65 | 6c 76 65 73 09 0d 09 09 |de ourse|lves....|
|00000aa0| 2f 2f 20 6e 6f 74 65 20 | 74 68 61 74 20 74 68 65 |// note |that the|
|00000ab0| 72 65 27 73 20 6e 6f 74 | 20 6d 75 63 68 20 77 65 |re's not| much we|
|00000ac0| 20 63 61 6e 20 64 6f 20 | 61 62 6f 75 74 20 72 65 | can do |about re|
|00000ad0| 70 6f 72 74 69 6e 67 20 | 65 72 72 6f 72 73 20 62 |porting |errors b|
|00000ae0| 65 79 6f 6e 64 20 68 65 | 72 65 0d 09 7d 0d 09 43 |eyond he|re..}..C|
|00000af0| 61 74 63 68 28 65 72 72 | 29 0d 09 7b 0d 09 09 72 |atch(err|)..{...r|
|00000b00| 65 73 75 6c 74 20 3d 20 | 65 72 72 3b 0d 09 7d 0d |esult = |err;..}.|
|00000b10| 09 0d 09 4f 53 45 72 72 | 20 65 72 72 3b 0d 09 09 |...OSErr| err;...|
|00000b20| 0d 09 65 72 72 20 3d 20 | 41 45 50 75 74 41 74 74 |..err = |AEPutAtt|
|00000b30| 72 69 62 75 74 65 50 74 | 72 28 63 6f 6e 74 65 78 |ributePt|r(contex|
|00000b40| 74 2d 3e 66 52 65 70 6c | 79 2c 20 6b 65 79 45 72 |t->fRepl|y, keyEr|
|00000b50| 72 6f 72 4e 75 6d 62 65 | 72 2c 20 74 79 70 65 53 |rorNumbe|r, typeS|
|00000b60| 68 6f 72 74 49 6e 74 65 | 67 65 72 2c 20 26 72 65 |hortInte|ger, &re|
|00000b70| 73 75 6c 74 2c 20 73 69 | 7a 65 6f 66 28 72 65 73 |sult, si|zeof(res|
|00000b80| 75 6c 74 29 29 3b 0d 0d | 23 69 66 20 71 44 65 62 |ult));..|#if qDeb|
|00000b90| 75 67 0d 09 69 66 20 28 | 65 72 72 29 0d 09 09 50 |ug..if (|err)...P|
|00000ba0| 72 6f 67 72 61 6d 42 72 | 65 61 6b 28 22 5c 70 41 |rogramBr|eak("\pA|
|00000bb0| 45 50 75 74 41 74 74 72 | 69 62 75 74 65 50 74 72 |EPutAttr|ibutePtr|
|00000bc0| 20 66 61 69 6c 65 64 20 | 69 6e 73 74 61 6c 6c 69 | failed |installi|
|00000bd0| 6e 67 20 65 72 72 6f 72 | 20 63 6f 64 65 20 2d 20 |ng error| code - |
|00000be0| 76 65 72 79 20 62 61 64 | 22 29 3b 0d 23 65 6e 64 |very bad|");.#end|
|00000bf0| 69 66 0d 0d 09 65 72 72 | 20 3d 20 41 45 52 65 73 |if...err| = AERes|
|00000c00| 75 6d 65 54 68 65 43 75 | 72 72 65 6e 74 45 76 65 |umeTheCu|rrentEve|
|00000c10| 6e 74 28 63 6f 6e 74 65 | 78 74 2d 3e 66 45 76 65 |nt(conte|xt->fEve|
|00000c20| 6e 74 2c 20 63 6f 6e 74 | 65 78 74 2d 3e 66 52 65 |nt, cont|ext->fRe|
|00000c30| 70 6c 79 2c 20 6b 41 45 | 4e 6f 44 69 73 70 61 74 |ply, kAE|NoDispat|
|00000c40| 63 68 2c 20 30 29 3b 09 | 2f 2f 20 54 68 69 73 20 |ch, 0);.|// This |
|00000c50| 68 61 64 20 62 65 74 74 | 65 72 20 77 6f 72 6b 0d |had bett|er work.|
|00000c60| 0d 23 69 66 20 71 44 65 | 62 75 67 0d 09 69 66 20 |.#if qDe|bug..if |
|00000c70| 28 65 72 72 29 0d 09 09 | 44 65 62 75 67 53 74 72 |(err)...|DebugStr|
|00000c80| 28 22 5c 70 41 45 52 65 | 73 75 6d 65 54 68 65 43 |("\pAERe|sumeTheC|
|00000c90| 75 72 72 65 6e 74 45 76 | 65 6e 74 20 66 61 69 6c |urrentEv|ent fail|
|00000ca0| 65 64 20 2d 20 76 65 72 | 79 20 62 61 64 22 29 3b |ed - ver|y bad");|
|00000cb0| 0d 23 65 6e 64 69 66 0d | 0d 09 64 65 6c 65 74 65 |.#endif.|..delete|
|00000cc0| 20 63 6f 6e 74 65 78 74 | 3b 0d 0d 09 72 65 74 75 | context|;...retu|
|00000cd0| 72 6e 20 6e 69 6c 3b 0d | 7d 0d 0d 70 61 73 63 61 |rn nil;.|}..pasca|
|00000ce0| 6c 20 4f 53 45 72 72 20 | 41 45 48 61 6e 64 6c 65 |l OSErr |AEHandle|
|00000cf0| 49 6e 54 68 72 65 61 64 | 28 0d 09 09 09 09 09 63 |InThread|(......c|
|00000d00| 6f 6e 73 74 20 41 70 70 | 6c 65 45 76 65 6e 74 2a |onst App|leEvent*|
|00000d10| 09 65 76 65 6e 74 2c 0d | 09 09 09 09 09 41 70 70 |.event,.|.....App|
|00000d20| 6c 65 45 76 65 6e 74 2a | 09 09 09 72 65 70 6c 79 |leEvent*|...reply|
|00000d30| 2c 0d 09 09 09 09 09 41 | 45 45 76 65 6e 74 48 61 |,......A|EEventHa|
|00000d40| 6e 64 6c 65 72 55 50 50 | 09 68 61 6e 64 6c 65 72 |ndlerUPP|.handler|
|00000d50| 2c 0d 09 09 09 09 09 6c | 6f 6e 67 09 09 09 09 68 |,......l|ong....h|
|00000d60| 61 6e 64 6c 65 72 52 65 | 66 63 6f 6e 2c 0d 09 09 |andlerRe|fcon,...|
|00000d70| 09 09 09 54 68 72 65 61 | 64 4f 70 74 69 6f 6e 73 |...Threa|dOptions|
|00000d80| 09 09 6f 70 74 69 6f 6e | 73 2c 0d 09 09 09 09 09 |..option|s,......|
|00000d90| 53 69 7a 65 09 09 09 09 | 73 74 61 63 6b 73 69 7a |Size....|stacksiz|
|00000da0| 65 29 0d 7b 0d 09 4f 53 | 45 72 72 09 09 09 20 72 |e).{..OS|Err... r|
|00000db0| 65 73 75 6c 74 3b 0d 09 | 41 45 54 68 72 65 61 64 |esult;..|AEThread|
|00000dc0| 43 6f 6e 74 65 78 74 2a | 20 63 6f 6e 74 65 78 74 |Context*| context|
|00000dd0| 20 3d 20 6e 65 77 20 41 | 45 54 68 72 65 61 64 43 | = new A|EThreadC|
|00000de0| 6f 6e 74 65 78 74 28 68 | 61 6e 64 6c 65 72 2c 20 |ontext(h|andler, |
|00000df0| 65 76 65 6e 74 2c 20 72 | 65 70 6c 79 2c 20 68 61 |event, r|eply, ha|
|00000e00| 6e 64 6c 65 72 52 65 66 | 63 6f 6e 29 3b 0d 09 0d |ndlerRef|con);...|
|00000e10| 09 54 72 79 0d 09 7b 0d | 09 09 46 61 69 6c 4e 49 |.Try..{.|..FailNI|
|00000e20| 4c 28 63 6f 6e 74 65 78 | 74 29 3b 0d 09 0d 09 09 |L(contex|t);.....|
|00000e30| 63 6f 6e 74 65 78 74 2d | 3e 43 72 65 61 74 65 54 |context-|>CreateT|
|00000e40| 68 72 65 61 64 28 6b 43 | 6f 6f 70 65 72 61 74 69 |hread(kC|ooperati|
|00000e50| 76 65 54 68 72 65 61 64 | 2c 20 28 54 68 72 65 61 |veThread|, (Threa|
|00000e60| 64 45 6e 74 72 79 50 72 | 6f 63 50 74 72 29 20 41 |dEntryPr|ocPtr) A|
|00000e70| 45 54 68 72 65 61 64 43 | 6f 6e 74 65 78 74 3a 3a |EThreadC|ontext::|
|00000e80| 41 45 54 68 72 65 61 64 | 50 72 6f 63 2c 20 73 74 |AEThread|Proc, st|
|00000e90| 61 63 6b 73 69 7a 65 2c | 20 6f 70 74 69 6f 6e 73 |acksize,| options|
|00000ea0| 29 3b 0d 0d 09 09 72 65 | 73 75 6c 74 20 3d 20 41 |);....re|sult = A|
|00000eb0| 45 53 75 73 70 65 6e 64 | 54 68 65 43 75 72 72 65 |ESuspend|TheCurre|
|00000ec0| 6e 74 45 76 65 6e 74 28 | 65 76 65 6e 74 29 3b 0d |ntEvent(|event);.|
|00000ed0| 09 7d 0d 09 43 61 74 63 | 68 28 65 72 72 29 0d 09 |.}..Catc|h(err)..|
|00000ee0| 7b 0d 09 09 64 65 6c 65 | 74 65 20 63 6f 6e 74 65 |{...dele|te conte|
|00000ef0| 78 74 3b 0d 0d 09 09 72 | 65 73 75 6c 74 20 3d 20 |xt;....r|esult = |
|00000f00| 65 72 72 3b 0d 09 7d 0d | 09 0d 09 72 65 74 75 72 |err;..}.|...retur|
|00000f10| 6e 20 72 65 73 75 6c 74 | 3b 0d 7d 0d 0d 0d 2f 2f |n result|;.}...//|
|00000f20| 23 70 72 61 67 6d 61 20 | 73 65 67 6d 65 6e 74 20 |#pragma |segment |
|00000f30| 53 70 61 77 6e 0d 0d 70 | 61 73 63 61 6c 20 4f 53 |Spawn..p|ascal OS|
|00000f40| 45 72 72 20 53 70 61 77 | 6e 41 45 54 68 72 65 61 |Err Spaw|nAEThrea|
|00000f50| 64 28 63 6f 6e 73 74 20 | 41 70 70 6c 65 45 76 65 |d(const |AppleEve|
|00000f60| 6e 74 20 2a 65 76 65 6e | 74 2c 20 41 70 70 6c 65 |nt *even|t, Apple|
|00000f70| 45 76 65 6e 74 20 2a 72 | 65 70 6c 79 2c 20 6c 6f |Event *r|eply, lo|
|00000f80| 6e 67 20 68 61 6e 64 6c | 65 72 52 65 66 63 6f 6e |ng handl|erRefcon|
|00000f90| 29 0d 7b 0d 09 41 45 54 | 68 72 65 61 64 44 65 73 |).{..AET|hreadDes|
|00000fa0| 63 2a 20 64 65 73 63 20 | 3d 20 28 41 45 54 68 72 |c* desc |= (AEThr|
|00000fb0| 65 61 64 44 65 73 63 2a | 29 20 68 61 6e 64 6c 65 |eadDesc*|) handle|
|00000fc0| 72 52 65 66 63 6f 6e 3b | 0d 20 0d 20 09 72 65 74 |rRefcon;|. . .ret|
|00000fd0| 75 72 6e 20 41 45 48 61 | 6e 64 6c 65 49 6e 54 68 |urn AEHa|ndleInTh|
|00000fe0| 72 65 61 64 28 65 76 65 | 6e 74 2c 20 72 65 70 6c |read(eve|nt, repl|
|00000ff0| 79 2c 0d 09 09 09 09 09 | 09 09 64 65 73 63 2d 3e |y,......|..desc->|
|00001000| 68 61 6e 64 6c 65 72 2c | 0d 09 09 09 09 09 09 09 |handler,|........|
|00001010| 64 65 73 63 2d 3e 72 65 | 66 63 6f 6e 2c 0d 09 09 |desc->re|fcon,...|
|00001020| 09 09 09 09 09 64 65 73 | 63 2d 3e 6f 70 74 69 6f |.....des|c->optio|
|00001030| 6e 73 2c 0d 09 09 09 09 | 09 09 09 64 65 73 63 2d |ns,.....|...desc-|
|00001040| 3e 73 74 61 63 6b 53 69 | 7a 65 29 3b 0d 7d 0d 0d |>stackSi|ze);.}..|
|00001050| 0d 0d 0d 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001060| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001070| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001080| 00 00 01 00 00 00 01 f5 | 00 00 00 f5 00 00 00 66 |........|.......f|
|00001090| 72 65 73 65 6e 74 3b 0d | 09 09 09 6d 73 67 2d 3e |resent;.|...msg->|
|000010a0| 6d 61 6e 75 61 6c 2e 66 | 73 31 20 3d 20 6d 73 67 |manual.f|s1 = msg|
|000010b0| 0c 41 45 54 68 72 65 61 | 64 73 2e 63 70 31 02 00 |.AEThrea|ds.cp1..|
|000010c0| 00 00 54 45 58 54 4d 4d | 43 43 01 00 00 34 01 40 |..TEXTMM|CC...4.@|
|000010d0| 00 00 54 45 58 54 4d 4d | 43 43 01 00 00 34 01 40 |..TEXTMM|CC...4.@|
|000010e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000010f0| 00 00 a9 9d 70 e2 00 00 | 0f d3 00 00 02 5b 4d 61 |....p...|.....[Ma|
|00001100| 6e 75 61 6c 29 3b 09 2f | 2f 20 57 65 27 76 65 20 |nual);./|/ We've |
|00001110| 67 6f 74 20 6d 61 6e 75 | 61 6c 20 64 61 74 61 0d |got manu|al data.|
|00001120| 09 09 09 63 73 6c 6f 63 | 20 09 20 3d 20 26 6d 73 |...csloc| . = &ms|
|00001130| 67 2d 3e 6d 61 6e 75 61 | 6c 2e 63 73 3b 0d 09 09 |g->manua|l.cs;...|
|00001140| 7d 0d 09 09 65 6c 73 65 | 0d 09 09 7b 0d 44 65 62 |}...else|...{.Deb|
|00001150| 75 67 67 65 72 28 29 3b | 0d 09 09 09 46 61 69 6c |ugger();|....Fail|
|00001160| 75 72 65 28 70 61 72 61 | 6d 45 72 72 2c 20 30 29 |ure(para|mErr, 0)|
|00001170| 3b 0d 09 09 7d 0d 09 09 | 0d 09 09 61 6d 6f 75 6e |;...}...|...amoun|
|00001180| 00 00 00 1e 00 57 00 04 | 01 8c 02 63 00 57 00 04 |.....W..|...c.W..|
|00001190| 01 8c 02 63 00 00 00 00 | 00 00 00 00 00 00 00 00 |...c....|........|
|000011a0| 00 00 00 00 00 7b fd a4 | 44 bc 3f e5 32 30 00 04 |.....{..|D.?.20..|
|000011b0| 00 00 00 01 00 00 00 00 | ab 4b 01 68 ab 4b 01 66 |........|.K.h.K.f|
|000011c0| aa 81 1d 14 00 98 85 cc | 00 02 00 10 00 01 1a 53 |........|.......S|
|000011d0| 70 72 6f 63 6b 65 74 50 | 72 6f 6a ba 53 70 72 6f |procketP|roj.Spro|
|000011e0| 63 6b 65 74 ba 4c 69 62 | ba 00 0f 44 61 76 65 20 |cket.Lib|...Dave |
|000011f0| 46 61 6c 6b 65 6e 62 75 | 72 67 00 01 31 00 0b 41 |Falkenbu|rg..1..A|
|00001200| 45 54 68 72 65 61 64 73 | 2e 63 00 00 00 00 11 46 |EThreads|.c.....F|
|00001210| 69 72 73 74 20 63 68 65 | 63 6b 65 64 20 69 6e 2e |irst che|cked in.|
|00001220| 00 00 00 00 48 00 09 4d | 6f 6e 61 63 6f 00 00 00 |....H..M|onaco...|
|00001230| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|00001240| 00 00 00 00 00 00 00 00 | 03 00 04 00 57 00 04 01 |........|....W...|
|00001250| dc 02 63 00 57 00 04 01 | dc 02 63 ac f0 d8 db 00 |..c.W...|..c.....|
|00001260| 00 09 60 00 00 09 61 00 | 00 08 29 01 00 00 00 00 |..`...a.|..).....|
|00001270| 04 00 01 00 01 00 00 01 | 00 00 00 01 f5 00 00 00 |........|........|
|00001280| f5 00 00 00 66 00 be f0 | f0 16 c6 00 00 00 1c 00 |....f...|........|
|00001290| 66 00 02 4d 50 53 52 00 | 01 00 1a 63 6b 69 64 00 |f..MPSR.|...ckid.|
|000012a0| 00 00 32 4d 57 42 42 00 | 00 00 3e 03 f0 ff ff 00 |..2MWBB.|..>.....|
|000012b0| 00 00 00 00 00 00 00 03 | ed ff ff 00 00 00 a1 00 |........|........|
|000012c0| 00 00 00 00 80 ff ff 00 | 00 00 22 00 00 00 00 03 |........|..".....|
|000012d0| f0 ff ff 00 00 00 ed 00 | 00 00 00 00 00 00 00 00 |........|........|
|000012e0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
|000012f0| 00 00 00 00 00 00 00 00 | 00 00 00 00 00 00 00 00 |........|........|
+--------+-------------------------+-------------------------+--------+--------+